from PIL import Image
import Mod as mod

img_str = '2.jpg'

list = mod.main1(img_str,True)
img = Image.open(img_str)
for i in range(len(list)):
    region = img.crop((list[i][0][0], list[i][0][1], list[i][1][0], list[i][1][1]))
    region.save('baidu\\'+str(i)+'.jpg')
    print(mod.img_to_str('baidu\\' + str(i) + '.jpg'))
    print(i,'-------------------------------')
